Evolutionary lottery of skull and beak morphology


Beak and skull shapes in birds of prey (“raptors”) are strongly coupled and largely controlled by size.

gif provided by the awesome Jen Bright @MorphobeakGeek!

In this exercise we will use a github repo to collaboratively collate and simulate evolutionary trajectories for each participants’ species body size using a simple brownian motion evolutionary model. This assumes evolutionary steps to progress comletely at random. You could say:

it’s a bit of lottery!


Each participant has created and contributed a file specifying the parameters required to simulate and plot their species evolutionary trajectory. We’ve collect all participants’ files in the master repo. Next we need to simulate species trajectories plot them up.

Participants will then get to see the skull and beak shape corresponding to their species relative body size!


setup

First we load the required packages and create some objects to compile data on trait evolution for each species.

require(dplyr)
require(ggplot2)
require(plotly)
set.seed(1)

t <- 0:100  # generate time vector
dt <- NULL # generate object to compile time-series data
cols <- NULL # generate object to compile trendline colours

Simulate trait evolution, iterate over all species files in params/ folder

We’ll use the parameters supplied in your scripts to generate brownian trait evolution trendline for each species.

spp.files <- dir("params/")[dir("params/") != "params_tmpl.R"]

for(spp in spp.files){
  # source parameters for each species
  source(file.path("params", spp))
  
  # generate trait evolution time-series and compile plotting data
  dt <-  rbind(dt, data.frame(t, 
                              trait = c(0, rnorm(n = length(t) - 1, sd = sqrt(sig2)) %>% cumsum()),
                              species = species.name))
  cols <- c(cols, color)
}

Plot trait evolution timeseries

Use the data generated to plot all species.

p <- ggplot(data = dt, aes(x = t, y = trait, group = species, colour = species)) + 
  geom_line() + 
  scale_colour_manual(values = cols) 
  
  ggplotly(p)



Skulls! find the skull associated with your species:


Skulls are organised from largest to smallest. The largest skulls are vulture-like, (e.g. no. 50, the Andean condor Vultur gryphus) and the smallest are falconet-like, (e.g. no. 1 Collared falconet Microhierax caerulescens)

No: 49 Tyrannosaurus_James

No: 34 cosmos_germanii

No: 29 gianmarco_linx

No: 27 gerardicus_ridiculus

No: 26 neili_shephardus

No: 25 raoulus

No: 25 mattius_leachia

No: 24 silver bird

No: 21 davidus_wilbyii

No: 21 juan_guerrero

No: 21 hui_wibyli

No: 12 sina_t

No: 7 louisus_alleni

Session Info

sessioninfo::session_info()
## - Session info ---------------------------------------------------------------
##  setting  value                       
##  version  R version 4.1.3 (2022-03-10)
##  os       Windows 10 x64              
##  system   x86_64, mingw32             
##  ui       RTerm                       
##  language (EN)                        
##  collate  English_United Kingdom.1252 
##  ctype    English_United Kingdom.1252 
##  tz       Europe/London               
##  date     2022-04-12                  
## 
## - Packages -------------------------------------------------------------------
##  ! package     * version date       lib source        
##  P cli           3.1.0   2021-10-27 [?] CRAN (R 4.1.2)
##  P colorspace    2.0-2   2021-06-24 [?] CRAN (R 4.1.2)
##  P crayon        1.4.2   2021-10-29 [?] CRAN (R 4.1.2)
##  P crosstalk     1.1.1   2021-01-12 [?] CRAN (R 4.1.1)
##  P data.table    1.14.2  2021-09-27 [?] CRAN (R 4.1.3)
##  P digest        0.6.28  2021-09-23 [?] CRAN (R 4.1.2)
##  P dplyr       * 1.0.7   2021-06-18 [?] CRAN (R 4.1.2)
##  P ellipsis      0.3.2   2021-04-29 [?] CRAN (R 4.1.2)
##  P evaluate      0.14    2019-05-28 [?] CRAN (R 4.1.2)
##  P fansi         0.5.0   2021-05-25 [?] CRAN (R 4.1.2)
##  P fastmap       1.1.0   2021-01-25 [?] CRAN (R 4.1.2)
##  P generics      0.1.1   2021-10-25 [?] CRAN (R 4.1.2)
##  P ggplot2     * 3.3.5   2021-06-25 [?] CRAN (R 4.1.2)
##  P glue          1.5.0   2021-11-07 [?] CRAN (R 4.1.2)
##  P gtable        0.3.0   2019-03-25 [?] CRAN (R 4.1.2)
##  P htmltools     0.5.2   2021-08-25 [?] CRAN (R 4.1.2)
##  P htmlwidgets   1.5.4   2021-09-08 [?] CRAN (R 4.1.3)
##  P httr          1.4.2   2020-07-20 [?] CRAN (R 4.1.3)
##  P jsonlite      1.7.2   2020-12-09 [?] CRAN (R 4.1.2)
##  P knitr         1.36    2021-09-29 [?] CRAN (R 4.1.2)
##  P labeling      0.4.2   2020-10-20 [?] CRAN (R 4.1.1)
##  P lazyeval      0.2.2   2019-03-15 [?] CRAN (R 4.1.3)
##  P lifecycle     1.0.1   2021-09-24 [?] CRAN (R 4.1.2)
##  P magrittr      2.0.1   2020-11-17 [?] CRAN (R 4.1.2)
##  P munsell       0.5.0   2018-06-12 [?] CRAN (R 4.1.2)
##  P pillar        1.6.4   2021-10-18 [?] CRAN (R 4.1.2)
##  P pkgconfig     2.0.3   2019-09-22 [?] CRAN (R 4.1.2)
##  P plotly      * 4.9.4.1 2021-06-18 [?] CRAN (R 4.1.1)
##  P purrr         0.3.4   2020-04-17 [?] CRAN (R 4.1.2)
##  P R6            2.5.1   2021-08-19 [?] CRAN (R 4.1.2)
##  P renv          0.14.0  2021-07-21 [?] CRAN (R 4.1.2)
##  P rlang         0.4.12  2021-10-18 [?] CRAN (R 4.1.2)
##  P rmarkdown     2.10    2021-08-06 [?] CRAN (R 4.1.1)
##  P rstudioapi    0.13    2020-11-12 [?] CRAN (R 4.1.3)
##  P scales        1.1.1   2020-05-11 [?] CRAN (R 4.1.2)
##  P sessioninfo   1.1.1   2018-11-05 [?] CRAN (R 4.1.1)
##  P stringi       1.7.6   2021-11-29 [?] CRAN (R 4.1.2)
##  P stringr       1.4.0   2019-02-10 [?] CRAN (R 4.1.2)
##  P tibble        3.1.6   2021-11-07 [?] CRAN (R 4.1.2)
##  P tidyr         1.1.4   2021-09-27 [?] CRAN (R 4.1.2)
##  P tidyselect    1.1.1   2021-04-30 [?] CRAN (R 4.1.2)
##  P utf8          1.2.2   2021-07-24 [?] CRAN (R 4.1.2)
##  P vctrs         0.3.8   2021-04-29 [?] CRAN (R 4.1.2)
##  P viridisLite   0.4.0   2021-04-13 [?] CRAN (R 4.1.2)
##  P withr         2.4.2   2021-04-18 [?] CRAN (R 4.1.2)
##  P xfun          0.28    2021-11-04 [?] CRAN (R 4.1.2)
##  P yaml          2.2.1   2020-02-01 [?] CRAN (R 4.1.1)
## 
## [1] C:/Users/bobturner/Documents/collaborative_github_exercise/renv/library/R-4.1/x86_64-w64-mingw32
## [2] C:/Users/bobturner/AppData/Local/Temp/Rtmpeye7SA/renv-system-library
## 
##  P -- Loaded and on-disk path mismatch.

This projects uses renv for dependency management.